fix: improve typing of RuleResult#390
Conversation
|
@emilefokkemanavara thanks for putting this up. I'll take a look later today or over the weekend. |
|
@chris-pardy Thanks for the heads up! |
|
@emilefokkemanavara This looks great, expect for one issue. The a evaluation of JSON Rules Engine follows these steps:
This means that if a condition doesn't get evaluated it will still be in the rule result but it won't have properties like This set of conditions {
"all": [
{ "fact": "age", "operator": "greaterThanInclusive", "value": 21, "priority": 1 },
{ "fact": "likesOranges", "operator": "equal", "value": true, "priority": 2 }
]
}The result can look like this. {
"all": [
{"fact": "age", "operator": "greaterThanInclusive", "value": 21, "priority": 1, "factResult": 20 },
{ "fact": "likesOranges", "operator": "equal", "value": true, "priority": 2 }
]
} |
@chris-pardy So this means |
Yes, that's correct. |
commit 1356b48 Author: Emile Fokkema <emile.fokkema@navara.nl> Date: Sun Nov 10 20:08:27 2024 +0100 result and factResult are not always there commit 725fb66 Author: Emile Fokkema <emile.fokkema@navara.nl> Date: Sat Nov 9 20:07:13 2024 +0100 condition reference can be part of the result commit cb5f3c7 Author: Emile Fokkema <146825801+emilefokkemanavara@users.noreply.github.com> Date: Fri Nov 8 16:27:34 2024 +0000 there are no condition references in the result commit c688692 Author: Emile Fokkema <146825801+emilefokkemanavara@users.noreply.github.com> Date: Fri Nov 8 16:27:09 2024 +0000 begin to add condition result types commit 7a90a81 Author: Emile Fokkema <146825801+emilefokkemanavara@users.noreply.github.com> Date: Fri Nov 8 16:26:42 2024 +0000 add toJSON method to RuleResult
1356b48 to
1d00bef
Compare
re-apply the changes from #390 onto v8
This PR closes #352 by improving the typing of RuleResult.